﻿Imports lbGlobalcom
Public Class fHojaVidaProducto

    Private Sub fHojaVidaProducto_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dtpFechaDesde.Value = dtpFechaHasta.Value.AddDays(-30)
    End Sub

    Private Sub btnBuscaProducto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscaProducto.Click
        Try
            Dim flProducto As New fListaProductos
            If flProducto.ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.txtProducto.Text = flProducto.idArticulo
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Henry")
        End Try
    End Sub

    Private Sub btnBuscaBodDes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscaBodOri.Click
        Try
            Dim flBodega As New fListaBodegas
            If flBodega.ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.txtBodegaOrigen.Text = flBodega.Bodega
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Henry")
        End Try
    End Sub

    Private Sub mostrarMovimiento()
        Try
            Dim cProd As New cHojaVida(Me.txtProducto.Text, Me.txtBodegaOrigen.Text, Me.txtBodegaDestino.Text, Me.dtpFechaDesde.Text, Me.dtpFechaHasta.Text, DsConsultaMovimi)
            cProd.hojaVida()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Henry")
        End Try
    End Sub

    Private Sub btnConsultar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConsultar.Click
        Try
            DsConsultaMovimi.DETALLEMOVIMIENTO.Rows.Clear()
            If Me.txtProducto.Text.Length > 0 Then
                mostrarMovimiento()
            Else
                MessageBox.Show("Falta codigo del Producto")
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Henry")
        End Try
    End Sub

    Private Sub btnBuscaBogDes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscaBogDes.Click
        Try
            Dim flBodega As New fListaBodegas
            If flBodega.ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.txtBodegaDestino.Text = flBodega.Bodega
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Henry")
        End Try
    End Sub
End Class